{extend name="base" /}

{block name="content"}

<div class="g-main">

    <div class="m-main-title">

        <div class="m-container-fluid">

            <a href="{:url('index/welcome')}"><i class="icon icon-home"></i>首页</a>

            <span class="icon-angle-right"></span>

            <span>商城</span>

            <span class="icon-angle-right"></span>

            <span>商品管理</span>

            <span class="icon-angle-right"></span>

            <span>商品管理</span>

            <span class="icon-angle-right"></span>

            <span>商品回收站</span>

            <a class="u-flush"><i class="icon-repeat"></i></a>

        </div>

    </div>

    <div class="m-main-content">

        <div class="m-container">

            <form class="layui-form m-list-form">

                <table class="m-table">

                    <tbody class="datas">

                        <tr>

                            <th width="5%" style="text-align: center;">选择</th>

                            <th width="5%">ID</th>

                            <th width="8%">所在分类</th>

                            <th width="36%">商品名称</th>

                            <th width="8%">价格</th>

                            <th width="8%">总库存</th>

                            <th width="10%">销量（自定义/实际）</th>

                            <th width="10%">录入时间</th>

                            <th width="10%">操作</th>

                        </tr>

                        {foreach name="data" item="v"}

                        <tr>

                            <td align="center"><input type="checkbox" name="id[]" class="u-id" value="{$v.id}" lay-skin="primary" /></td>

                            <td>{$v.id}</td>

                            <td>{$v.category_name}</td>

                            <td>{$v.goods_name}</td>

                            <td>成本价：{$v.cost_price}<br/>市场价：{$v.market_price}<br/>销售价：{$v.sale_price}</td>

                            <td>{$v.goods_stock}</td>

                            <td>{$v.diy_sale_nums}/{$v.actual_sale_nums}</td>

                            <td>{$v.create_time}</td>

                            <td class="m-opt"><a class="u-recovery" title="恢复" data-id="{$v.id}"><i class="icon-undo"></i></a><a href="javascript:;" title="彻底删除" class="u-del-ensure" data-id="{$v.id}"><i class="icon-trash"></i></a></td>

                        </tr>

                        {/foreach}

                        <tr>

                            <td align="center"><input type="checkbox" value="1" lay-skin="primary" lay-filter="select_ids" /></td>

                            <td colspan="9" class="m-options"><button class="u-btn u-batch-recovery"><i class="icon-sort"></i>批量恢复</button></td>

                        </tr>

                    </tbody>

                </table>

            </form>

            {include file="public:page" /}

        </div>

    </div>

</div>

{/block}

{block name="extrajs"}
<script>
    $('.u-del-ensure').on('click', function(){
        var id              = $(this).attr('data-id');

        //询问框
        layer.confirm('您确定要执行此操作吗？', {
            btn: ['确定', '取消']
        }, function(){
            $.post('{:url("del_clear")}', {id:id}, function(ret){
                if (ret.status == 0) {
                    dialog.success(ret.message, function(){
                        window.location.reload();
                    });
                } else {
                    dialog.error(ret.message);
                }
            }, 'json');
        }, function(){

        });
    });
</script>

{include file="laypage" /}

{/block}